#include <iostream>

//void PassArray(int* a) {
//
//}

/*
void PassArray(int a[5]) {

}

void PassArray(int a[50]) {

}
*/

void PassArray(int(*a)[5]) {

}

//void PassArray(int(*a)[50]) {
//
//}


bool fun(int a, int b) {
	std::cout << "fun" << std::endl;
	return false;
}

bool fun1(bool ptrfun(int, int), int a, int b) {
	return ptrfun(a, b);
}

bool fun2(bool (*ptrfun)(int, int), int a, int b) {
	return ptrfun(a, b);
}


typedef bool(*FUNCPtr)(int, int);
using funcptr = bool(*)(int, int);

typedef bool(FUNC)(int, int);
using func = bool(int, int);

bool(*func3(int))(int, int){
	return fun;
}


int main() {
	int array[5] = {0, 1, 2, 3, 4};
	PassArray(&array);

	/*
	int array1[6] = { 0, 1, 2, 3, 4 };
	PassArray(&array1);
	*/

	int* ptr = array;			//数组名退化为指针
	int(*ptr2)[5] = &array;		//数组名取地址类型(数组指针), ≠ 数组名的类型
	int(&r)[5] = array;			//数组引用

	int a1 = ptr[0];
	int a2 = (*ptr2)[0];

	char c[12] = "hello world";
	const char* s = "hello world";
	char* ss = "hello world";

	//ss[0] = 'a';

	bool(*ptrfun)(int, int) = fun;
	bool(*ptrfun1)(int, int) = &fun;

	ptrfun(0, 0);
	(*ptrfun1)(0, 0);

	fun1(ptrfun, 0, 0);

	bool(*ptrfunc)(int, int) = func3(0);
	ptrfunc(0, 0);


	FUNCPtr ptrfun2 = fun;
	ptrfun2(0, 0);

	funcptr ptrfunc3 = fun;
	ptrfunc3(0, 0);

	FUNC* ptrfunc4 = fun;
	func* ptrfunc5 = fun;

	return 0;
}